<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!-- AUTHOR: Joey, Jason, Dakota -->
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <h:head>
        <f:facet name="first">
            <meta http-equiv="X-UA-Compatible" content="EmulateIE8" />
            <meta http-equiv="Content-Type" content="text/xhtml; charset=UTF-8" />
            <meta http-equiv="Cache-Control" content="no-cache" />
            <meta http-equiv="Pragma" content="no-cache" />
            <title><ui:insert name="title">Live Lab for Java 9e by Dakota Brown, Jason Ambos, and Joey Zichettella</ui:insert></title>
        </f:facet>
        <title>Live Lab for Java 9e by Dakota Brown, Jason Ambos, and Joey Zichettella</title>
        <link rel="stylesheet" type="text/css" href="jquery-ui-1.9.1.custom.css"/>
        <style type="text/css">
            h1{
                color:darkblue;
            }
            .ui-widget, .ui-widget .ui-widget {
                font-size: 95% !important;
            }
            body{
                font-size: 12px;
            }
        </style>
    </h:head>
    <h:body>
        <h:form id ="tabForm">
            <h1> Live Lab For Java 9e by Dakota, Jason, and Joey</h1>
            <p:growl id="growl" showDetail="true"/>
            <p:growl for="sticky" id="stickygrowl" showDetail="true" sticky="true"/>
            <p:tabView id="tabs" dynamic="true">
                <p:tab title="Student">
                    <p:outputPanel autoUpdate="true">
                        <div align="right">
                            <p:commandButton style="margin-right: 50px;" value="Log Out" update="@(:tabform:sTab)" action="#{studentLoginBean.logout}" rendered="#{studentLoginBean.loggedIn}"/> 
                        </div>
                    </p:outputPanel>
                    <p:outputPanel id="sTab">
                        <p:tabView style="border-style: none" dynamic="true" rendered="#{studentLoginBean.loggedIn}">
                            <p:tab title="Complete Exercise">
                                <ui:include src="completeExercise.xhtml" />
                            </p:tab>
                            <p:tab title="Exercise Summary">
                                <ui:include src="exerciseSummary.xhtml" />
                            </p:tab>
                            <p:tab title="Peer Review">

                            </p:tab>
                            <p:tab title="Self Test">

                            </p:tab>
                            <p:tab title="Take Instructor-Assigned Quiz">

                            </p:tab>
                        </p:tabView>
                    </p:outputPanel>
                    <p:outputPanel id="studentForm" autoUpdate="true" >
                        <h:panelGroup rendered="#{studentLoginBean.isntLoggedIn}" >
                            <h:outputText value="Student Login " />
                            <h:panelGrid frame="box">
                                <h:outputText value="Student Username: " />
                                <p:inputText value="#{studentLoginBean.username}" id="studentUsername" required="true" requiredMessage="Username Required" />
                                <p:message for="studentUsername" />

                                <h:outputText value="Password: " />
                                <p:password value="#{studentLoginBean.password}" id="studentPassword" required="true" requiredMessage="Password Required" feedback="false"/>
                                <p:message for="studentPassword" />

                                <p:commandButton id="sSubmit" value="Login" process="studentForm" update=":tabForm:growl @(:tabform:sTab)" oncomplete="" action="#{studentLoginBean.login}" />
                                <h:outputLink value="createStudent.xhtml"><h:outputText value="Create New Account"/></h:outputLink>
                                <h:outputLink value=""><h:outputText value="Forgot Password?"/></h:outputLink>
                                <h:outputLink value=""><h:outputText value="Change Password"/></h:outputLink>
                            </h:panelGrid>
                        </h:panelGroup>
                    </p:outputPanel>
                </p:tab>
                <p:tab title="Instructor">
                    <p:outputPanel autoUpdate="true">
                        <div align="right">
                            <p:commandButton style="margin-right: 50px;" value="Log Out" update="@(:tabform:iTab)" action="#{instructorLoginBean.logout}" rendered="#{instructorLoginBean.loggedIn}"/>
                        </div>
                    </p:outputPanel>
                    <p:outputPanel id="iTab">
                        <p:tabView style="border-style: none;" dynamic="true" rendered="#{instructorLoginBean.loggedIn}">
                            <p:tab title="Create Exercise">

                            </p:tab>
                            <p:tab id="assignExercise" title="Assign Exercise">
                                <ui:include src="assignExercise.xhtml" /> 
                            </p:tab>
                            <p:tab title="Examine/Grade Exercise">
                                <ui:include src="examineGradeExercise.xhtml" />
                            </p:tab>
                            <p:tab title="Check Exercise Progress">
                                <ui:include src="exerciseProgressSummary.xhtml" />
                            </p:tab>
                            <p:tab title="Plagerism Check">

                            </p:tab>
                            <p:tab title="Manage Account">
                                <ui:include src="manageAccount.xhtml" />
                            </p:tab>
                            <p:tab title="Create Quiz">

                            </p:tab>
                            <p:tab title="Assign Quiz">

                            </p:tab>
                            <p:tab title="Examine Quiz">

                            </p:tab>
                            <p:tab id="attendance" title="Attendance">
                                <ui:include src="attendance.xhtml" />
                            </p:tab>

                        </p:tabView>
                    </p:outputPanel>
                    <p:outputPanel id="instructorForm" autoUpdate="true" >
                        <h:panelGroup  rendered="#{instructorLoginBean.isntLoggedIn}">
                            <h:outputText value="Instructor Login " />
                            <h:panelGrid frame="box">
                                <h:outputText value="Instructor Username: " />
                                <p:inputText value="#{instructorLoginBean.username}" id="instructorUsername" required="true" requiredMessage="Username Required" />
                                <p:message for="instructorUsername" />

                                <h:outputText value="Password: " />
                                <p:password value="#{instructorLoginBean.password}" id="instructorPassword" required="true" requiredMessage="Password Required" feedback="false" />
                                <p:message for="instructorPassword" />

                                <p:commandButton id="iSubmit" value="Login" process="instructorForm" update=":tabForm:growl @(:tabform:iTab)" action="#{instructorLoginBean.login}" />

                                <h:outputLink value="createInstructor.xhtml"><h:outputText value="Create New Account"/></h:outputLink>
                                <h:outputLink value=""><h:outputText value="Forgot Password?"/></h:outputLink>
                                <h:outputLink value=""><h:outputText value="Change Password"/></h:outputLink>
                            </h:panelGrid>
                        </h:panelGroup>
                    </p:outputPanel>
                </p:tab>
            </p:tabView>
        </h:form>
    </h:body>
</html>

